//
// Created by Administrator on 2022/2/3.
//

#ifndef CPP_LEARNING_LEETCODE1047_H
#define CPP_LEARNING_LEETCODE1047_H
#include <string>
#include <vector>
#include <stack>
#include <iostream>
using namespace std;
class Solution1047 {
public:
    string removeDuplicates(string s) {
        string result;
        for(int i=0;i<s.size();i++){
            if(!result.empty() && result.back() == s[i]){
                result.pop_back();
            }else{
                result.push_back(s[i]);
            }
        }
        return result;
    }
};

void test1047(){
    Solution1047 s;
    string str = "abbaca";
    std::cout<<s.removeDuplicates(str)<<std::endl;

}
#endif //CPP_LEARNING_LEETCODE1047_H
